﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using IHISCETeim.BLL;
using IHISCETeim.Library;
using IHISCETeim.Model;
using System.Text;
using System.Data;
namespace IHISCETeim.Web.MachineSys.XZModel
{
    public partial class XZJobTrainList : PageBase
    {

        protected override Permission[] PowerKey
        {
            get
            {
                return new Permission[] { Permission.查看, Permission.修改, Permission.新增, Permission.删除 };
            }
        }
        protected override string DWZRef
        {
            get
            {
                return "XZJobTrainList";
            }


        }

        protected string GetFolderTree()
        {

            List<string> retlist = XZJobTrainController.GetAllTrainDept();
            /// <ul><li><a href="JSDWF/JSDWFFolderPageList.aspx?ParFolderID=1" target="ajax" rel="jbsxBox">尿检</a></li></ul>
            StringBuilder sb = new StringBuilder();
            //sb.Append("<ul>");
            foreach (string itm in retlist)
            {
                string showdeptstring = GetSubTree(itm);
                if (!string.IsNullOrEmpty(showdeptstring))
                {
                    sb.Append("<li>");
                    sb.AppendFormat("<a href=\"#\" >{0}</a>", itm);
                    sb.Append(showdeptstring);
                    sb.Append("</li>");                    
                }
              
            }
         //   sb.Append("</ul>");

            return sb.ToString();
        }

        protected string GetSubTree(string TrainDept)
        {
            List<XZJobListInfo> retlist = XZJobTrainController.GetAllXZJobListByJobDept(TrainDept);
            if (retlist == null || retlist.Count<=0)
                return "";
            /// <ul><li><a href="JSDWF/JSDWFFolderPageList.aspx?ParFolderID=1" target="ajax" rel="jbsxBox">尿检</a></li></ul>
            StringBuilder sb = new StringBuilder();
            sb.Append("<ul>");
            foreach (XZJobListInfo itm in retlist)
            {
                sb.Append("<li>");
                sb.AppendFormat("<a href=\"XZModel/XZJobTrainDetail.aspx?JobId={0}\" target=\"ajax\" rel=\"XZJobTrainListDetailBox\">{1}</a>", itm.JobId, itm.Title);

                // sb.Append(GetFolderTree(itm.FolderID));

                sb.Append("</li>");
            }
            sb.Append("</ul>");

            return sb.ToString();
        }
        protected void Page_Load(object sender, EventArgs e)
        {

        }
    }
}